<template>
    <div class="videobox" v-show="showMv">
        <video :src="mvUrl"
                class="video"
                controls
                autoplay></video>
            <div class="videoClose" @click="mvHide">
                <img src="../../assets/shutoff.png" alt="">
            </div>
        </div>
</template>
<script>
export default {
    name:'PlayMv',
    props:{
        MvId:{
            type:Number,
            required:true
        }
    },
    data(){
        return{
            mvUrl:'',
            showMv:false
        }
    },
    watch:{
        MvId(){
            this.showMv=true
            this.playMv()
        }
    },
    methods:{
        // 播放Mv
        playMv() {
            let o = {
                id: this.MvId
            }
            this.$api.PlayMv(o).then(res => {
                this.mvUrl = res.data.url
            }).catch(() => {})
        },
        // 去掉遮罩层,清空mv地址
         mvHide() {
            this.showMv = false
            this.mvUrl = ''
        },
    }
}
</script>
<style scoped>
.videobox{
    width: 100%;
    height: 100%;
    position: absolute;
    background-color: rgba(0,0,0,.8);
    top: 0;
    left: 0;
    z-index: 2;
}
.video{
    width: 1200px;
    height: 700px;
    margin: auto;
}
.videoClose{
    position: absolute;
    top: 50px;
    right: 100px;
}
</style>